package com.longai.service;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import util.Page;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.longai.dao.*;
import com.longai.model.*;
@Service
public class UserService {
	@Autowired
    UserDAO userDAO;
	public User findById(int id){
		return userDAO.findById(id);
	}
	public void save(User user){
		userDAO.save(user);
	}
	public void delete(User user){
		userDAO.delete(user);
	}
	public List<User> findAll(){
		return userDAO.findAll();
	}
	
public List<User> valid(String name) {
    	return userDAO.findByName(name);
		
	}
	public Page getLover(double gens,String page,String amount) throws IOException{
		Gson gson = new Gson();
		Page list = userDAO.findLover(gens,page,amount);
		return list;
	}
	
	public List<User> findByName(String name){
		return userDAO.findByName(name);
	}
}